package com.goudan.rabbitmq.listener;

import com.goudan.rabbitmq.support.SpringContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.Date;
import java.util.Map;

/**
 * 延迟队列消费者
 */
@Slf4j
@Component
public class DelayQueueListener{

    private Collection<TotalTransInfoListener> transInfoHandlerCollection;

    private static ApplicationContext applicationContext = null;

    @RabbitListener(queues = "${rabbitmq.delay.queue:delayed.queue}")
    public void receiveDelayQueue(Message message) throws Exception {
        String msg = new String(message.getBody());
        log.info("当前时间：{}，收到延迟队列消息：{}", new Date(), msg);

    }

}
